package HomeWork;

import java.util.Arrays;
import java.util.Random;

public class Demo1 {
    public static void main(String[] args) {
        int[] a = new int[100];
        Random rand = new Random();
        for (int i = 0; i < 100; i++) {
            a[i] = rand.nextInt(101);
        }
        System.out.println(Arrays.toString(a));
    }
}

interface Person {
    void speak();
    void eat();
}

abstract class Human implements Person {
    protected String name;
    protected int age;

    public Human(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public void speak() {
        System.out.println(name + "正在说话");
    }

    @Override
    public void eat() {
        System.out.println(name + "正在吃东西");
    }

    public abstract void work();
}

class Father extends Human {
    public Father(String name, int age) {
        super(name, age);
    }

    @Override
    public void work() {
        System.out.println(name + "是父亲");
    }

    public void disciplineSon() {
        System.out.println(name + "正在教导儿子");
    }
}

class Mother extends Human {
    public Mother(String name, int age) {
        super(name, age);
    }

    @Override
    public void work() {
        System.out.println(name + "是母亲");
    }

    public void careForSon() {
        System.out.println(name + "正在教导儿子");
    }
}

class Son extends Human {
    public Son(String name, int age) {
        super(name, age);
    }

    @Override
    public void work() {
        System.out.println(name + "正在学习");
    }

    public void playWithToys() {
        System.out.println(name + "正在玩游戏");
    }
}

class Demo5 {
    public static void main(String[] args) {
        Human father = new Father("李明", 45);
        Human mother = new Mother("王菲", 42);
        Human son = new Son("李丽", 12);
        father.speak();
        father.eat();
        father.work();
        ((Father) father).disciplineSon();
        mother.speak();
        mother.eat();
        mother.work();
        ((Mother) mother).careForSon();
        son.speak();
        son.eat();
        son.work();
        ((Son) son).playWithToys();
    }
}